package com.logistics.account.entity.model;

import com.logistics.account.entity.domain.Account;
import com.logistics.utils.aspect.annotation.Dictionary;
import com.logistics.utils.tool.DateUtils;
import lombok.Data;

import java.util.List;

@Data
public class AccountRow {

    private Integer id;
    private String account;
    private String password;
    private String code;
    private String userName;
    private String mobile;
    private String email;
    private String wx;
    private String qq;
    private String province;
    private String city;
    private String area;
    private String address;
    private String post;
    private String organization;
    private String dep;
    private String createTime;
    private String creator;
    private String updater;
    private String updateTime;
    private List<String> roleIds;

    public AccountRow(){

    }

    public AccountRow(Account account){
        this.id = account.getId();
        this.account = account.getAccount();
        this.code = account.getCode();
        this.userName = account.getUserName();
        this.mobile = account.getMobile();
        this.email = account.getEmail();
        this.wx = account.getWx();
        this.qq = account.getQq();
        this.province = account.getProvince();
        this.city = account.getCity();
        this.address = account.getAddress();
        this.post = account.getPost();
        this.organization = account.getOrganization();
        this.dep = account.getDep();
        this.creator = account.getCreator();
        this.createTime = DateUtils.dateToStringFormat(account.getCreateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
        this.updateTime = DateUtils.dateToStringFormat(account.getUpdateTime(), DateUtils.YYYY_MM_DD_HH_MM_SS);
        this.updater = account.getUpdater();
    }

    public static AccountRow build(Account account){
        return new AccountRow(account);
    }

}
